package com.banmoon.iterator;

import java.util.Iterator;

public class IteratorMain {

    public static void main(String[] args) {
        Bookshelf bookshelf = new Bookshelf();
        bookshelf.add(new Book("Java从入门到入土"));
        bookshelf.add(new Book("Java虚拟机"));
        bookshelf.add(new Book("Java内存模型"));

        Iterator iterator = bookshelf.createIterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
    }
}
